package io;
/**
 * 演示OutputStreamWrite的写入操作
 */

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;

public class OswDemo{

public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("./test.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        osw.write("写信告诉我今天刚");
        osw.write("未完待续");
        System.out.println("写出完毕");
        osw.close();
    }
}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               